from utils.network import Interface


class API(Interface):
    def handle(self, req):
        recv = self.user.recv_messages
        self.user.recv_messages = []
        msgs = [msg.as_view() for msg in recv]
        return self.success_respond({
            'messages': msgs
        })
